Skip to content

Fix #9050: Allow multidenotations with same signature #9063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 4, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 27, 2020

Instead of issuing a merge error, allow multi-denotations with alternatives that have the same
signature.

@odersky odersky force-pushed the fix-#9050 branch 2 times, most recently from d948982 to 70bf21b Compare May 27, 2020 21:37
@odersky
Copy link
Contributor Author

odersky commented May 27, 2020

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/9063/ to see the changes.

Benchmarks is based on merging with master (2116281)

@odersky
Copy link
Contributor Author

odersky commented May 28, 2020

test performance please

@odersky
Copy link
Contributor Author

odersky commented May 28, 2020

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 1 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/9063/ to see the changes.

Benchmarks is based on merging with master (5e9d927)

@odersky
Copy link
Contributor Author

odersky commented May 29, 2020

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 1 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/9063/ to see the changes.

Benchmarks is based on merging with master (af37d64)

@odersky
Copy link
Contributor Author

odersky commented May 29, 2020

test performance please

@dottybot
Copy link
Member

performance test scheduled: 2 job(s) in queue, 1 running.

@odersky odersky marked this pull request as ready for review May 29, 2020 16:09
@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/9063/ to see the changes.

Benchmarks is based on merging with master (0540e5e)

odersky added 6 commits June 1, 2020 15:21
Instead of issuing a merge error, allow multi-denotations with alternatives that have the same
signature.
Test only for methods. Others cannot get signature clashes
through asSeenFrom. That is, if they clash after asSeenFrom,
they already clash before.
Wait until overloading resolution instead.
@dottybot
Copy link
Member

dottybot commented Jun 2, 2020

performance test scheduled: 1 job(s) in queue, 1 running.

@dottybot
Copy link
Member

dottybot commented Jun 2, 2020

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/9063/ to see the changes.

Benchmarks is based on merging with master (1ef1765)

@odersky
Copy link
Contributor Author

odersky commented Jun 2, 2020

test performance please

@dottybot
Copy link
Member

dottybot commented Jun 2, 2020

performance test scheduled: 2 job(s) in queue, 1 running.

Comment on lines 457 to 467
val linScore = linearScore(sym1.owner, sym2.owner)
if linScore != 0 then linScore
else
val boundary1 = accessBoundary(sym1)
val boundary2 = accessBoundary(sym2)
if boundary1.isProperlyContainedIn(boundary2) then -1
else if boundary2.isProperlyContainedIn(boundary1) then 1
else if sym1.is(Bridge) && !sym2.is(Bridge) then -2
else if sym2.is(Bridge) && !sym1.is(Bridge) then 2
else if sym2.is(Method) && !sym1.is(Method) then -2
else if sym1.is(Method) && !sym2.is(Method) then 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the ordering of these checks determined? I would have expected them to be ordered to preserve monotonicity when possible: e.g. given that a bridge vs a non-bridge gives a score of -2, I would not expect that score to decrease because of the relative access boundary of that bridge. Is there some other property than monotonicity that can guide us here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it's also worth noting that as of dotty-staging@32f9deb we should never encounter any bridge symbol until Erasure, so that particular check might not be needed anymore)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It models the ordering that we had previously.

@odersky
Copy link
Contributor Author

odersky commented Jun 3, 2020

test performance please

@odersky
Copy link
Contributor Author

odersky commented Jun 3, 2020

@liufengyun Could you check the benchmark application? It never came back from the previous request.

@liufengyun
Copy link
Contributor

I'll have a look at the problem of the previous request.

The bot does not respond just now because it stopped early this morning due to a network error (lampepfl/bench#213), and now it's back to be working again.

@dottybot
Copy link
Member

dottybot commented Jun 3, 2020

performance test scheduled: 2 job(s) in queue, 1 running.

@liufengyun
Copy link
Contributor

The problem is spotted (lampepfl/bench#214), will fix ASAP and run the test.

@dottybot
Copy link
Member

dottybot commented Jun 3, 2020

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/9063/ to see the changes.

Benchmarks is based on merging with master (5fce8e6)

@odersky
Copy link
Contributor Author

odersky commented Jun 3, 2020

Thanks for getting the benchmark running, Fengyun! Looking at the latest number it seems it's fast enough without the dubious optimization with the NeedsSelectIn attachment. I was worried about a spike for scalap from the previous results, but that has gone down again, so it looks like it was noise after all. So I think it's ready for another round of reviews.

* pick the associated denotation.
* 3. Otherwise, if the two infos can be combined with `infoMeet`, pick that as
* result info, and pick the symbol that scores higher as result symbol,
* or pick `sym2` as a tie breaker. The picked info and symbol are combined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why sym2 and not sym1 as the tie breaker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was sym2 before. I now went through the callers, but I can see no reason why it should be. Single denotations are merged with the left operand first in linearization order. So it makes some sense to keep it that way (maybe?, or it makes no difference at all, I am not sure).

@odersky odersky assigned smarter and unassigned odersky Jun 4, 2020
@@ -122,7 +123,7 @@ Standard-Section: "ASTs" TopLevelStat*
TERMREFsymbol sym_ASTRef qual_Type -- A reference `qual.sym` to a local member with prefix `qual`
TERMREFpkg fullyQualified_NameRef -- A reference to a package member with given fully qualified name
TERMREF possiblySigned_NameRef qual_Type -- A reference `qual.name` to a non-local member
TERMREFin Length possiblySigned_NameRef qual_Type namespace_Type -- A reference `qual.name` to a non-local member that's private in `namespace`
TERMREFin Length possiblySigned_NameRef qual_Type owner_Type -- A reference `qual.name` referring to a non-local symbol declared in owner that has the given signature (see note below)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the documentation for TYPEREFin be updated in a similar way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No since TypeRefs never take a signature

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, glad to see this taken care of!

@odersky odersky merged commit 2fbefb0 into scala:master Jun 4, 2020
@odersky odersky deleted the fix-#9050 branch June 4, 2020 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants